<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=
    , initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 500px;
            height: 500px;
            color: white;
            background-color: black;
            box-sizing: border-box;
            cursor: crosshair;
        }
    </style>
</head>

<body>
    <div id="div">
        鼠标移入改变样式，鼠标移出恢复
    </div>
</body>
<script>
    let div = document.getElementById('div')
    div.onmouseenter = function () {
        div.style.border = '10px solid red'
        div.style.backgroundColor = 'silver'
        div.style.color = 'red'
    }
    div.onmouseleave = function () {
        div.style.border = ''
        div.style.backgroundColor = 'black'
        div.style.color = 'white'
    }
</script>

</html>